VxSpinButton


Create a SpinButton

Syntax

VxSpinButton object_name width lower underCB upper overCB increment default userCB position [upOp] [dnOp]

Description

Creates a SpinButton, which consists of a Text field and two buttons which increase and decrease the numeric value in the Text field within upper and lower bounds. Returns the name of the enclosing form widget.

Parameters

object_name
The widget hierarchy of this SpinButton.

width
The width of the Text widget.

lower
The lower boundary value.

underCB
A callback for when the value goes below the lower bound. If a null callback is specified (by using ""), the value automatically wraps around to the upper value.

upper
The upper boundary value.

overCB
A callback for when the value goes over the upper bound. If a null callback is specified (by using ""), the value automatically wraps around to the lower value.

increment
Specifies by how much the value increases or decreases.

default
The initial default value.

userCB
A callback which checks the value of the Text widget when the user presses return in the Text widget.

position
Any of the standard geometryArgs for the Text widget.

upOp
The operation to perform on increment when the "up" button is pressed. The default operation is +.

dnOp
Optional operation to perform on increment when the "down" button is pressed. The default operation is -.

Example

The following code produces a SpinBox which allows the user to select odd numbers between 1 and 9 inclusive.

set app [VtOpen demo]

set form [VtFormDialog $app.form -title "VtSpinButton Demo" ]
set fn [VxSpinButton $form.fn 25 1 "" 9 "" 2 5 "" "" ]

VtShow $form
VtMainLoop

This code produces the following:

Notes

The returned Form widget name is attached to the name of the Text widget and Rowcolumn widget containing the buttons:

VxGetVar $sb text
for the Text widget.

VxGetVar $sb rowcol
for the RowColumn widget.